const vscode = require('vscode')
const ztmz_tokens_provider = require('./tokens_provider');

async function getHoverProvider() {
    return vscode.languages.registerHoverProvider({ language: 'pacenote', scheme: 'file' }, {
        provideHover(document, position, cancelToken) {
            let range = document.getWordRangeAtPosition(position);
            let word = document.getText(range);
            if (ztmz_tokens_provider.tokenDict[word]) {
                let token = ztmz_tokens_provider.tokenDict[word];
                return new vscode.Hover(token.markdown);
            }
            return undefined;
        }
    });
}


module.exports = {
    getHoverProvider
}
